package edu.mit.csail.relo.intro.preferences;

import org.eclipse.jface.preference.*;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.IWorkbench;
import edu.mit.csail.relo.intro.ReloIntroPlugin;

/**
 * @author vineet
 *
 */
public class ReloPreferencePage	extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {

	public ReloPreferencePage() {
		super(GRID);
		setPreferenceStore(ReloIntroPlugin.getDefault().getPreferenceStore());
		setDescription("Preferences for the Relo integration");
	}
	
	public void createFieldEditors() {
        String curJavaVer = "your current version: " + System.getProperty("java.version");
        addField(new BooleanFieldEditor(
                PreferenceConstants.Java5CheckKey, 
                PreferenceConstants.Java5CheckPrompt + " (" + curJavaVer + ")", 
                getFieldEditorParent()));
        
        addField(new BooleanFieldEditor(
                PreferenceConstants.BuilderCheckConnectionAtStartupKey, 
                PreferenceConstants.BuilderCheckConnectionAtStartupPrompt, 
                getFieldEditorParent()));
        
        addField(new BooleanFieldEditor(
                PreferenceConstants.LabelItemsWithContextKey, 
                PreferenceConstants.LabelItemsWithContextPrompt, 
                getFieldEditorParent()){
        	protected void doStore() {
        		super.doStore();
        		PreferenceConstants.labelItemsWithContext = getBooleanValue();
        	}
        });

        addField(new BooleanFieldEditor(
                PreferenceConstants.DisableIncreamentBuildKey, 
                PreferenceConstants.DisableIncreamentBuildPrompt, 
                getFieldEditorParent()){
        	protected void doStore() {
        		super.doStore();
        		PreferenceConstants.disableIncreamentBuild = getBooleanValue();
        	}
        });
}

	/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
     */
	public void init(IWorkbench workbench) {
	}
	
}